package com.blog.common.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.blog.common.domain.annotation.Convert;
import com.blog.common.domain.enums.ConvertEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;


/**
 * <p>
 * 文章
 * </p>
 *
 * @author Valerie
 * @since 2023-03-11
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("tb_article")
@ApiModel(value = "Article对象", description = "文章")
public class Article implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty("作者")
    @TableField("user_id")
    private Long userId;

    @ApiModelProperty("文章分类")
    @TableField("category_id")
    private Long categoryId;

    @ApiModelProperty("文章缩略图")
    @TableField("article_cover")
    @Convert
    private String articleCover;

    @ApiModelProperty("标题")
    @TableField("article_title")
    private String articleTitle;

    @ApiModelProperty("内容")
    @TableField("article_content")
    @Convert(ConvertEnums.Encryption)
    private String articleContent;


    @ApiModelProperty("预编译的文章内容")
    @TableField("compiled_article_content")
    @Convert(ConvertEnums.Encryption)
    private String compiledArticleContent;

    @ApiModelProperty("文章类型 1原创 2转载 3翻译")
    @TableField("type")
    private Boolean type;

    @ApiModelProperty("原文链接")
    @TableField("original_url")
    private String originalUrl;

    @ApiModelProperty("是否推荐 0否 1是")
    @TableField("is_recommend")
    private String isRecommend;

    @ApiModelProperty("是否置顶 0否 1是")
    @TableField("is_top")
    private Integer isTop;

    @ApiModelProperty("是否删除  0否 1是")
    @TableField("is_delete")
    @TableLogic
    private Integer isDelete;

    @ApiModelProperty("状态值 1公开 2私密 3评论可见")
    @TableField("status")
    private Integer status;

    @ApiModelProperty("发表时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;
}
